package com.mygame.gateway.common;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "xinyue.game.gateway.config")
public class GatewayServerConfig {

	private int port;
	/** netty boss线程的个数，默认是 1 */
	private int bossThreadCount =1;
	/** channel 工作线程的个数，默认是cpu的核数 */
	private int workThreadCount = Runtime.getRuntime().availableProcessors();
	private long recBufSize;
	private long sendBufSize;
	// 达到压缩的消息最小大小
	private int compressMessageSize = 1024 * 2;
	// 等待认证的超时时间
	private int waiteConfirmTimeoutSecond = 10;
	/**
	 * 单个用户的限流请允许的每秒请求数量
	 */
	private double requestPerSecond = 10;
	/**
	 * 全局流量限制请允许每秒请求数量
	 */
	private double globalRequestPerSecond = 2000;
	/**
	 * channel读取空闲时间
	 */
	private int readerIdleTimeSeconds = 300;
	/**
	 * channel写出空闲时间
	 */
	private int writerIdleTimeSeconds = 12;
	/** 是否允许使用心跳，默认是true */
	private boolean enableHeartbet = true;
	/**
	 * 读写空闲时间
	 */
	private int allIdleTimeSeconds = 15;

	

	

	

	

	public int getReaderIdleTimeSeconds() {
		return readerIdleTimeSeconds;
	}

	public void setReaderIdleTimeSeconds(int readerIdleTimeSeconds) {
		this.readerIdleTimeSeconds = readerIdleTimeSeconds;
	}

	public int getWriterIdleTimeSeconds() {
		return writerIdleTimeSeconds;
	}

	public void setWriterIdleTimeSeconds(int writerIdleTimeSeconds) {
		this.writerIdleTimeSeconds = writerIdleTimeSeconds;
	}

	public int getAllIdleTimeSeconds() {
		return allIdleTimeSeconds;
	}

	public void setAllIdleTimeSeconds(int allIdleTimeSeconds) {
		this.allIdleTimeSeconds = allIdleTimeSeconds;
	}

	public double getRequestPerSecond() {
		return requestPerSecond;
	}

	public void setRequestPerSecond(double requestPerSecond) {
		this.requestPerSecond = requestPerSecond;
	}

	public double getGlobalRequestPerSecond() {
		return globalRequestPerSecond;
	}

	public void setGlobalRequestPerSecond(double globalRequestPerSecond) {
		this.globalRequestPerSecond = globalRequestPerSecond;
	}

	public void setGlobalRequestPerSecond(int globalRequestPerSecond) {
		this.globalRequestPerSecond = globalRequestPerSecond;
	}

	public int getWaiteConfirmTimeoutSecond() {
		return waiteConfirmTimeoutSecond;
	}

	public void setWaiteConfirmTimeoutSecond(int waiteConfirmTimeoutSecond) {
		this.waiteConfirmTimeoutSecond = waiteConfirmTimeoutSecond;
	}

	public int getCompressMessageSize() {
		return compressMessageSize;
	}

	public void setCompressMessageSize(int compressMessageSize) {
		this.compressMessageSize = compressMessageSize;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public int getBossThreadCount() {
		return bossThreadCount;
	}

	public void setBossThreadCount(int bossThreadCount) {
		this.bossThreadCount = bossThreadCount;
	}

	public int getWorkThreadCount() {
		return workThreadCount;
	}

	public void setWorkThreadCount(int workThreadCount) {
		this.workThreadCount = workThreadCount;
	}

	public long getRecBufSize() {
		return recBufSize;
	}

	public void setRecBufSize(long recBufSize) {
		this.recBufSize = recBufSize;
	}

	public long getSendBufSize() {
		return sendBufSize;
	}

	public void setSendBufSize(long sendBufSize) {
		this.sendBufSize = sendBufSize;
	}

	public boolean isEnableHeartbet() {
		return enableHeartbet;
	}

	public void setEnableHeartbet(boolean enableHeartbet) {
		this.enableHeartbet = enableHeartbet;
	}

}
